package com.example.influxdbspring;

import com.influxdb.client.InfluxDBClient;
import com.influxdb.client.InfluxDBClientFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


/**
 * @author Jenson
 */
@Configuration
public class InfluxdbConfig {

    @Value("${jenson.influxdb.url}")
    private String url;

    @Value("${jenson.influxdb.token}")
    private String token;

    @Bean("influxdbClient")
    InfluxDBClient createInfluxdbClient(){
        // 生成客户端
        InfluxDBClient client = InfluxDBClientFactory.create(this.url, this.token.toCharArray());

        return client;
    }
}


